{% extends "base.html" %}
{% block title %}工作令号管理{% endblock %}
{% block navbar %}{{ super() }}{% endblock %}
{% block styles %}{{ super() }}
<style>
    .main-div {
        background: #ffffff none repeat scroll 0 0;
        border-radius: 2px;
        margin: 10px auto 30px;
        max-width: 80%;
        padding: 20px 20px 20px 20px;
    }

    body {
        padding-top: 100px;
    }
</style>
<link href="{{ url_for('static', filename='datatables/datatables.min.css') }}" rel="stylesheet">
{% endblock %}
{% block scripts %}{{ super() }}
<script src="{{ url_for('static', filename='datatables/datatables.min.js') }}"></script>
<script>
    // $('#toggle-event').bootstrapToggle('on');
    $(function () {
        $('#toggle-event').change(function () {
            if ($(this).prop('checked')) {
                $('tr.danger').css({ 'display': 'none' });
            } else {
                $('tr.danger').css({ 'display': '' });
            }
        });
    });
</script>
<script>
    $(document).ready(function () {
        $('#dt').DataTable(
            {
                "autoWidth": false,
                "pageLength": 50,
                "order": [[0, "desc"]]
            });
    });
</script>
{% endblock %}
{% block content %}
<div class="container">
    <div class="row">
        <div class="col-xs-1 col-sm-1 col-md-1 col-lg-1"></div>
        <div class="col-xs-10 col-sm-10 col-md-10 col-lg-10">
            {% include 'flash_message.html' %}
            <a class="btn btn-success" href="{{ url_for('bp_admin.admin_jobnumber_create') }}">新增</a>
            <input id="toggle-event" type="checkbox" data-toggle="toggle" data-off="显示全部" data-on="隐藏删除"
                data-onstyle="default" data-offstyle="default" checked>
            <table id="dt" class="row-border hover compact" style="width:100%">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>工作令号</th>
                        <th>项目名称</th>
                        <th>是否可用</th>
                        <th>操作</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    {% for jobnumber in jobnumbers %}
                    {% if jobnumber[3] %}
                    <tr class="danger" style="display:none">
                        {% else %}
                    <tr>
                        {% endif %}
                        <td>{{ jobnumber[0] }}</td>
                        <td>{{ jobnumber[1] }}</td>
                        <td>{{ jobnumber[2] }}</td>
                        <td>{{ not jobnumber[3] }}</td>
                        <td><a href="{{ url_for('bp_admin.admin_jobnumber_edit', jobnumberid=jobnumber[0]) }}">编辑</a>
                        </td>
                        <td><a href="{{ url_for('bp_admin.admin_jobnumber_delete', jobnumberid=jobnumber[0]) }}">
                                {% if jobnumber[3] %}
                                恢复
                                {% else %}
                                删除
                                {% endif %}
                            </a></td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
        <div class="col-xs-1 col-sm-1 col-md-1 col-lg-1"></div>
    </div>
</div>
{% endblock %}